package com.wzu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzu.entity.Insured;
import com.wzu.mapper.InsuredMapper;
import com.wzu.service.InsuredService;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class InsuredServiceImpl extends ServiceImpl<InsuredMapper, Insured> implements InsuredService {
    @Override
    public List<Insured> searchInsured(String keyword) {
        QueryWrapper<Insured> wrapper = new QueryWrapper<>();
        if (keyword != null && !keyword.isEmpty()) {
            wrapper.like("insured_name", keyword).or().like("caard_id", keyword);
        }
        return list(wrapper);
    }
    @Override
    public boolean addInsured(Insured insured) {
        return save(insured);
    }
    @Override
    public boolean updateInsured(Insured insured) {
        return updateById(insured);
    }
    @Override
    public boolean deleteInsured(Integer id) {
        return removeById(id);
    }
} 